package com.shaobufan.museum.pojo.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDate;

/**
 * 任务表
 * @TableName mission
 */
@TableName(value ="mission")
@Data
public class Mission implements Serializable {
    /**
     * 任务id
     */
    @TableId(value = "mission_id", type = IdType.AUTO)
    private Integer missionId;

    /**
     * 任务名称
     */
    @TableField(value = "mission_name")
    private String missionName;

    /**
     * 任务详情
     */
    @TableField(value = "mission_detail")
    private String missionDetail;

    /**
     * 任务等级
     */
    @TableField(value = "mission_level")
    private Integer missionLevel;

    /**
     * 截止日期
     */
    @TableField(value = "deadline")
    private LocalDate deadline;

    /**
     * 任务状态 0-未完成 1-完成
     */
    @TableField(value = "status")
    private Integer status;

    /**
     * 负责部门
     */
    @TableField(value = "depart_id")
    private Integer departId;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Mission other = (Mission) that;
        return (this.getMissionId() == null ? other.getMissionId() == null : this.getMissionId().equals(other.getMissionId()))
            && (this.getMissionName() == null ? other.getMissionName() == null : this.getMissionName().equals(other.getMissionName()))
            && (this.getMissionDetail() == null ? other.getMissionDetail() == null : this.getMissionDetail().equals(other.getMissionDetail()))
            && (this.getMissionLevel() == null ? other.getMissionLevel() == null : this.getMissionLevel().equals(other.getMissionLevel()))
            && (this.getDeadline() == null ? other.getDeadline() == null : this.getDeadline().equals(other.getDeadline()))
            && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
            && (this.getDepartId() == null ? other.getDepartId() == null : this.getDepartId().equals(other.getDepartId()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getMissionId() == null) ? 0 : getMissionId().hashCode());
        result = prime * result + ((getMissionName() == null) ? 0 : getMissionName().hashCode());
        result = prime * result + ((getMissionDetail() == null) ? 0 : getMissionDetail().hashCode());
        result = prime * result + ((getMissionLevel() == null) ? 0 : getMissionLevel().hashCode());
        result = prime * result + ((getDeadline() == null) ? 0 : getDeadline().hashCode());
        result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
        result = prime * result + ((getDepartId() == null) ? 0 : getDepartId().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", missionId=").append(missionId);
        sb.append(", missionName=").append(missionName);
        sb.append(", missionDetail=").append(missionDetail);
        sb.append(", missionLevel=").append(missionLevel);
        sb.append(", deadline=").append(deadline);
        sb.append(", status=").append(status);
        sb.append(", departId=").append(departId);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}